<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
    <button>添加</button>
    <ul>
        <li>苹果</li>
        <li>鸭梨</li>
        <li>哈密瓜</li>
    </ul>
    <script src="../script/jquery.js"></script>
    <script>
        $("button").click(function(){
            let text=$("input").val();
            $("ul").append(`<li>${text}</li>`);
            $("input").val("")
        })
        $("ul").on("click","li",function(){
            $(this).remove()
        })
    </script>
</body>
</html>